#ifndef _APP_3AXIS_OUTPUT_H_
#define _APP_3AXIS_OUTPUT_H_
#include "stm32l0xx_hal.h"
#include "app_lis2dh12.h"
#include "sensor_config.h"

#define AXIS_BUFFER_SIZE   500//300

#define SWAP(x, y) {int8_t t=x; x=y; y=t;}

enum dma_state{
    DMA_BEGIN = 0x00,
    DMA_END,
};

enum sample_state{
    SAMPLE_ON = 0x00,
    SAMPLE_END,
};

typedef struct _Axis_type_t{
 int16_t axis_x;
 int16_t axis_y;
 int16_t axis_z;
}axis_type_t;

typedef struct _Axis_average_value_t{
 int16_t average_x;
 int16_t average_y;
 int16_t average_z;
}axis_average_value_t;

typedef struct _Axis_p2p_value_t{
 int16_t p2p_x;
 int16_t p2p_y;
 int16_t p2p_z;
}axis_p2p_value_t;

void lis2dh12_begin(void);
void lis2dh12_process(void);
void lis2dh12_end(void);

void lis2dh12_config(void);
void app_dma_flag_set(uint8_t data);
uint8_t app_dma_flag_get(void);
uint8_t lis2dh12_sample_end_flag(uint16_t sample_count);
void lis2dh12_get_config_info(lis2dh12_param_t* param_data);
#endif //_APP_3AXIS_OUTPUT_H_

